<%@page import="bean.User"%>
<%@page import="controller.MyPortfolioController"%>
<%@page import="view.MyPortfolioDataset"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.lang.Exception"%>
<% /* 	
@author Philipp Hollenstein
@version 10.07.2013
*/ %>
<% request.setAttribute("title", "Mein Portfolio"); %>
<%@include file="./includes/header.jsp" %>

Mein Portfolio

<%
	User user = ((User) session.getAttribute("loginUser"));
	MyPortfolioController myPortfolioController = new MyPortfolioController();
	ArrayList<MyPortfolioDataset> myPortfolioList = myPortfolioController.getPortfolioList(user);	
%>
Aktueller Kontostand: <%=myPortfolioController.getKontostandByUserPK(user) %><br>
<%
	if (myPortfolioList.size() > 0) {
%>
<table class = "tableCenter">
	<tr>
		<th>Symbol</th>
		<th>Aktie</th>
		<th>Anzahl</th>
		<th>Letzte Dividende (CHF)</th>
		<th>Aktion</th>
	</tr>
	<%
		for (MyPortfolioDataset d : myPortfolioList) {
	%>
	<tr>
		<td><%=d.getKuerzel()%></td>
		<td><%=d.getName()%></td>
		<td><%=d.getAnzahl()%></td>
		<td><%=d.getLetzteDividende()%></td>
		<td><form action="sell.do" method="post">
				<input name="sell" value="verkaufen" type="submit"> 
				<input type="hidden" name="aktienName" value="<%=d.getName()%>">
				<input type="hidden" name="kuerzel" value="<%=d.getKuerzel()%>">
			</form>
		</td>
	</tr>
	<%
		}
	%>
</table>
<%
	} else {
%>
Sie haben keine Aktie gekauft
<%
	}
%>



<%@include file="./includes/footer.jsp" %>